	
-- ***********************************************************************************************
-- GETUPDATECONFLICT Stored Procedures for the list of tables mentioned in the Initialize file
--------------------------------------------------------------------------------------------------

--TABLE NAME: Vendor    STORED PROCEDURE NAME: Sales.sync_sp_Vendor_GetUpdateConflict

use [SyncSamplesDb_ChangeTracking_Custom]

if object_id(N'Sales.sync_sp_Vendor_GetUpdateConflict', 'P') is not null
	drop procedure Sales.sync_sp_Vendor_GetUpdateConflict
GO

	create procedure Sales.sync_sp_Vendor_GetUpdateConflict(
        @VendorId uniqueidentifier       
        )
as
	SELECT		E.VendorId
				, E.VendorName
				, E.CreditRating
				, E.PreferredVendor
				, CT.SYS_CHANGE_CONTEXT
				, CT.SYS_CHANGE_VERSION 
	FROM		[SyncSamplesDb_ChangeTracking_Custom].[Sales].[Vendor] AS E
	JOIN		CHANGETABLE(VERSION [SyncSamplesDb_ChangeTracking_Custom].[Sales].[Vendor], ([VendorId]), (@VendorId)) AS CT  
				ON E.VendorId = CT.VendorId

GO

-------------------------------------------END------------------------------------------------------------------
